<html>
<head><meta charset="utf-8"><title>more principled `--keep-stage 1` · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html">more principled `--keep-stage 1`</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="135539759"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135539759" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135539759">(Oct 10 2018 at 13:11)</a>:</h4>
<p>So <span class="user-mention" data-user-id="124287">@mw</span> I was thinking... <code>--keep-stage 1</code> is an amazing time saver, but if you change the definition of things that wind up in metadata (or the metadata code itself) then things go haywire...</p>



<a name="135539773"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135539773" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135539773">(Oct 10 2018 at 13:11)</a>:</h4>
<p>but it seems <em>plausible</em> to me that we could hash the definitions of all types that may wind up in metadata</p>



<a name="135539838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135539838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135539838">(Oct 10 2018 at 13:12)</a>:</h4>
<p>I guess I'm thinking: it's plausible that we could make a variant of <code>--keep-stage 1</code> that's "always on" and approximates when it can be safely used. <em>Well</em>, always-on isn't right of course, but you could make it a <em>lot</em> safer</p>



<a name="135539849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135539849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135539849">(Oct 10 2018 at 13:13)</a>:</h4>
<p>I guess if you modified (e.g.) the type checker, you would always be foregoing the check to see that libstd and friends still type-check with your new code</p>



<a name="135539871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135539871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135539871">(Oct 10 2018 at 13:13)</a>:</h4>
<p>(which in turn might affect — if not the <em>structure</em> of metadata — then its contents)</p>



<a name="135961402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135961402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135961402">(Oct 17 2018 at 09:52)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> you mean <code>--keep-stage 0</code> right? <code>--keep-stage 1</code> will NOT keep stage 0. I have not yet found a case where keeping stage 1 is useful, but your workflow may differ?</p>



<a name="135963058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135963058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135963058">(Oct 17 2018 at 10:30)</a>:</h4>
<p>We have <em>got</em> to fix the <a href="https://rust-lang-nursery.github.io/rustc-guide/how-to-build-and-run.html?highlight=keep#suggested-workflows-for-faster-builds-of-the-compiler" target="_blank" title="https://rust-lang-nursery.github.io/rustc-guide/how-to-build-and-run.html?highlight=keep#suggested-workflows-for-faster-builds-of-the-compiler">rustc guide</a></p>



<a name="135963079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135963079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135963079">(Oct 17 2018 at 10:31)</a>:</h4>
<p>I stopped trying to use <code>--keep-stage</code> some time ago because I couldn't understand/predict when it would go wrong</p>



<a name="135963086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135963086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135963086">(Oct 17 2018 at 10:31)</a>:</h4>
<p>and then I recently tried to use <code>--keep-stage 1</code>, based on the rustc guide. And I <em>again</em> cannot understand/predict when it will go wrong. Except perhaps the prediction is "all the time" is about right.</p>



<a name="135963714"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135963714" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135963714">(Oct 17 2018 at 10:44)</a>:</h4>
<p>In any case, any idea that <span class="user-mention" data-user-id="116009">@nikomatsakis</span> and/or <span class="user-mention" data-user-id="124287">@mw</span>  have for making <code>--keep-stage N</code> be more defensive about its behavior gets a big <span class="emoji emoji-1f44d" title="thumbs up">:thumbs_up:</span> from me</p>



<a name="135963745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135963745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135963745">(Oct 17 2018 at 10:46)</a>:</h4>
<p>I use <code>--keep-stage 0 --keep-stage 1</code> when I'm modifying unit tests in e.g. <code>librustc_datastructures</code></p>



<a name="135965047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135965047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135965047">(Oct 17 2018 at 11:18)</a>:</h4>
<p>So, here's a simple question: Is <code>--keep-stage 0</code> <strong>expected</strong> to fail in weird ways if you use the flag on a clean checkout?</p>



<a name="135965130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135965130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135965130">(Oct 17 2018 at 11:20)</a>:</h4>
<p>In particular, I keep a shell script that I use to drive my builds. Currently it doesn't attempt to keep track whether this is a clean build or if we're building atop a previous build attempt. I had <em>assumed</em> that <code>--keep-stage</code> would fall back on building stuff if the things it needs are not present.</p>



<a name="135965338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135965338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135965338">(Oct 17 2018 at 11:24)</a>:</h4>
<p>I should probably go look at how its actually implemented rather than try to guess the semantics here.</p>



<a name="135965836"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135965836" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135965836">(Oct 17 2018 at 11:36)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> yeah I'd assume <code>--keep-stage</code> to just skip even trying to do any stage 0 build job</p>



<a name="135965859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135965859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135965859">(Oct 17 2018 at 11:37)</a>:</h4>
<p>I guess I would prefer if it fell back on building the stuff it needs if the needed files aren't even there in the first place</p>



<a name="135965900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135965900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135965900">(Oct 17 2018 at 11:38)</a>:</h4>
<p>potentially with some printouts saying that its doing so</p>



<a name="135965904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135965904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135965904">(Oct 17 2018 at 11:38)</a>:</h4>
<p>so what I usually do when I work on <code>librustc_mir</code> and need to build miri (which needs a stage 2 build): I first do <code>./x.py build src/rustc</code>, once, to get a clean everything; then then subsequent builds are <code>./x.py --keep-stage 0 build src/rustc</code>. That takes around 5min then (I feel it was faster some weeks ago...)</p>



<a name="135965911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135965911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135965911">(Oct 17 2018 at 11:38)</a>:</h4>
<p>you do <code>src/rustc</code> instead of <code>src/libstd</code> ?</p>



<a name="135965920"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135965920" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135965920">(Oct 17 2018 at 11:38)</a>:</h4>
<p>yeah I need a fully working stage 2</p>



<a name="135965925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135965925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135965925">(Oct 17 2018 at 11:38)</a>:</h4>
<p>IIRC <code>src/libstd</code> doesnt give me that</p>



<a name="135965935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135965935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135965935">(Oct 17 2018 at 11:39)</a>:</h4>
<p>the difference between the two is negligible though with stage 2</p>



<a name="135965939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135965939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135965939">(Oct 17 2018 at 11:39)</a>:</h4>
<p>it just copies some more stuff around</p>



<a name="135965940"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135965940" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135965940">(Oct 17 2018 at 11:39)</a>:</h4>
<p>oh sorry I overlooked that part of your message</p>



<a name="135965942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135965942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135965942">(Oct 17 2018 at 11:39)</a>:</h4>
<p>("fully working" = including proc macros)</p>



<a name="135965957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135965957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135965957">(Oct 17 2018 at 11:39)</a>:</h4>
<p>if it wasn't for that I'd just always do <code>./x.py --stage 1 build src/libstd</code> and would never even need <code>--keep-stage</code></p>



<a name="135971239"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135971239" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135971239">(Oct 17 2018 at 13:06)</a>:</h4>
<p>I never use <code>--keep-stage 0</code></p>



<a name="135971251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135971251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135971251">(Oct 17 2018 at 13:07)</a>:</h4>
<p>I have no idae what it does</p>



<a name="135971256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135971256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135971256">(Oct 17 2018 at 13:07)</a>:</h4>
<p>I use only <code>--keep-stage 1</code>, which I understand :)</p>



<a name="135971258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135971258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135971258">(Oct 17 2018 at 13:07)</a>:</h4>
<p>so, no, I did not mean <code>--keep-stage 0</code></p>



<a name="135971274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135971274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135971274">(Oct 17 2018 at 13:07)</a>:</h4>
<p>The instructions in the rustc-guide match precisely what I do, but I'm open to there being a better set of things to do :)</p>



<a name="135971322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135971322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135971322">(Oct 17 2018 at 13:08)</a>:</h4>
<p>in particular, I build with <code>--keep-stage 1</code> but only after I've already got a succesful build lying around ...</p>



<a name="135971398"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135971398" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135971398">(Oct 17 2018 at 13:09)</a>:</h4>
<blockquote>
<p>and then I recently tried to use <code>--keep-stage 1</code>, based on the rustc guide. And I <em>again</em> cannot understand/predict when it will go wrong. Except perhaps the prediction is "all the time" is about right.</p>
</blockquote>
<p>interesting <span class="user-mention" data-user-id="116083">@pnkfelix</span> . I do not find this at all. It basically goes wrong if I have rebased or something, but if I've just made a small edit to some fn, it is generally fine. (And if things "seem fishy", then I just try removing it.)</p>
<p>Interestingly, this aligns basically perfectly with my experiences with makefiles in the past. That is, makefiles never truly capture <em>all</em> the dependencies, so it's usually "hmm something is weird, better make clean". :P</p>



<a name="135971448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135971448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135971448">(Oct 17 2018 at 13:10)</a>:</h4>
<p>but I guess my basic attitude is to "add" <code>--keep-stage 1</code> when iterating, not to use it by default</p>



<a name="135971469"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135971469" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135971469">(Oct 17 2018 at 13:10)</a>:</h4>
<p>I think the core of my problem was my assumption was that i didn't actually <em>need</em> to start with the base run</p>



<a name="135971476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135971476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135971476">(Oct 17 2018 at 13:10)</a>:</h4>
<p>ah. yes, that would go wrong</p>



<a name="135971490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135971490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135971490">(Oct 17 2018 at 13:10)</a>:</h4>
<p>i.e. that <code>--keep-stage 1</code> would be "smart"  and build things that are truly not present</p>



<a name="135971507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135971507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135971507">(Oct 17 2018 at 13:11)</a>:</h4>
<p>which is .... well, I won't claim its what <code>make</code> always does. But its what <code>make</code> is <em>supposed</em> to do, given a "correct" <code>Makefile</code></p>



<a name="135972803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135972803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135972803">(Oct 17 2018 at 13:31)</a>:</h4>
<blockquote>
<p>which is .... well, I won't claim its what <code>make</code> always does. But its what <code>make</code> is <em>supposed</em> to do, given a "correct" <code>Makefile</code></p>
</blockquote>
<p>yes just ime never <em>actually</em> the case :P</p>



<a name="135972856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135972856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135972856">(Oct 17 2018 at 13:32)</a>:</h4>
<p>or, much like with <code>x.py</code>, if the makefile is correct -- then it is overconservative, and it offers some escape valves, which is exactly what <code>--keep-stage 1</code> is...</p>



<a name="135973386"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135973386" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135973386">(Oct 17 2018 at 13:41)</a>:</h4>
<blockquote>
<p>I use only <code>--keep-stage 1</code>, which I understand :)</p>
</blockquote>
<p>funny. I am dead scared of it.^^</p>



<a name="135973396"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135973396" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135973396">(Oct 17 2018 at 13:41)</a>:</h4>
<p>it recompiles stage0 but then does NOT recompile stage1.</p>



<a name="135973493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135973493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135973493">(Oct 17 2018 at 13:43)</a>:</h4>
<p>I have no idea what your workflow is like, to make that useful^^</p>



<a name="135973600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135973600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135973600">(Oct 17 2018 at 13:44)</a>:</h4>
<p>1. build compiler<br>
2. add a <code>debug!</code> log<br>
3. rebuild compiler, but do not rebuild libraries &lt;-- this is where <code>--keep-stage 1</code> makes sense</p>



<a name="135973609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135973609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135973609">(Oct 17 2018 at 13:44)</a>:</h4>
<p>a variation on (2) is "modify some part of the compiler that the libraries do not use"</p>



<a name="135973865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135973865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135973865">(Oct 17 2018 at 13:48)</a>:</h4>
<p>so what is your full invocation then?</p>



<a name="135973925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135973925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135973925">(Oct 17 2018 at 13:49)</a>:</h4>
<p><code>./x.py build -i --stage 1 src/libstd</code> is my "base invocation" 99% of the time</p>



<a name="135973931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135973931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135973931">(Oct 17 2018 at 13:49)</a>:</h4>
<p>I tack on <code>--keep-stage 1</code> if I just made a small alteration</p>



<a name="135973982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135973982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135973982">(Oct 17 2018 at 13:50)</a>:</h4>
<p>which of course is <em>actually</em> the vast majority of the time</p>



<a name="135973992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135973992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135973992">(Oct 17 2018 at 13:50)</a>:</h4>
<p>so in terms of # of builds I suppose that's the most common thing</p>



<a name="135974091"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135974091" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135974091">(Oct 17 2018 at 13:52)</a>:</h4>
<p>oh so you have <code>--stage 1 --keep-stage 1</code>. that makes some more sense, I get it.</p>



<a name="135974105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135974105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135974105">(Oct 17 2018 at 13:52)</a>:</h4>
<p>libstd builds in &lt;60s without <code>-i</code> so I dont usually bother optimizing that</p>



<a name="135974144"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/more%20principled%20%60--keep-stage%201%60/near/135974144" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/more.20principled.20.60--keep-stage.201.60.html#135974144">(Oct 17 2018 at 13:53)</a>:</h4>
<p>and for proc macros I need the starts to align or so, haven't found a way to cut that shorter. I guess I could try <code>--keep-stage 0 --keep-stage 2 --stage 2</code>...</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>